﻿using System;
using System . Collections . Generic;
using System . Linq;
using System . Text;
using System . Threading . Tasks;
using System . Globalization;
using OrangeEndless . Properties;

namespace OrangeEndless
{
	public class Achievement
	{
		public string Name { get; set; }

		public string Introduction { get; set; }

		public string Id { get; set; }

		public bool IsGet { get; set; }

		public Func<bool> Check { get; set; }

		public void Suspend ( )
		{
			Properties . Settings . Default [ Id + "IsGet" ] = IsGet;
		}

		public static Task<Achievement> LoadAchievement ( int key )
		{
			return Task . Run ( ( ) =>
			{
				string id="A" + key . ToString ( CultureInfo . InvariantCulture );
				var Temp= new Achievement
			   {
				   Name = AchievementsNameResource . ResourceManager . GetString ( id , CultureInfo . InvariantCulture ) ,
				   Introduction = AchievementsIntroductionResource . ResourceManager . GetString ( id , CultureInfo . InvariantCulture ) ,
				   //Check=
				   Id = id
			   };
				return Temp;
			} );
		}

	}
}
